package br.com.eSink.connection;

import br.com.esink.tests.Logging;
import java.io.File;
import java.net.Socket;

public class Sync extends Thread {

    private Socket csk;
    private File file;

    public Sync() {
    }

    public Sync(Socket csk) {
        this.csk = csk;
    }

    public Sync(Socket csk, File file) {
        this.csk = csk;
        this.file = file;
    }
      


    public Socket getCsk() {
        return csk;
    }

    public void setCsk(Socket csk) {
        this.csk = csk;
    }

    @Override
    public void run() {
        Logging.write("Enviando arquivo\n", true);
        file = new File("C:\\Users\\Administrador\\Desktop\\Teste");
        int nfiles = file.listFiles().length-1;
        Sharing.sendQuantity(csk, nfiles);
        
        for (File music : file.listFiles()) {            
            Sharing.sendFile(csk, music);
        }
        
        
        
    }
}
